feature

If you’ve been working with JavaScript for a while, you might have heard of npm: npm makes it easy for JavaScript developers to share the code that they’ve created to solve particular problems, and for other developers to reuse that code in their own application.

Commands

1) npm install
2) npm install grunt
3) bower install
4) grunt buildprod
5) grunt builddev

During the installation of bower , may show the error unable to connect to github. Enter the cmd bower install again in same command prompt.

Npm install -g :

It will install the npm package and allows to use globally.

Npm install – save :

It will install the corresponding package and save it in node modules and list an entry in dependencies in package.jason file.

Updating npm :

Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you’ll want to make sure it’s the latest version.

npm install npm@latest -g

Installing npm manually

For more advanced users. The npm module is available for download at

https://registry.npmjs.org/npm/-/npm-{VERSION}.tgz.

Creating node.js module

  • Publish your package to npm
  • Make a new directory outside of your project and cd into it
  • Run npm install
  • Create a test.js file which requires the package and calls the method
  • Run node test.js. The message should be output.

Example:

{ 
    “name”: “clofus”, 
    “version”: “0.1.0”, 
    “devDependencies”: { 
        “esprima”: “~1.0.4”, 
        “grunt”: “^0.4.5”, 
        “grunt-bower-concat”: “^0.4.0”, 
        “grunt-concat-css”: “^0.3.1”, 
        “grunt-contrib-clean”: “~0.5.0”, 
        “grunt-contrib-concat”: “~0.4.0”, 
        “grunt-contrib-copy”: “^0.7.0”, 
        “grunt-shell”: “^1.1.2”, 
        “grunt-stripcomments”: “^0.3.1”, 
        “grunt-uncss”: “^0.4.0”, 
        “grunt-wiredep”: “^2.0.0”, 
        “load-grunt-tasks”: “^1.0.0” 
    }, 
    “dependencies”: { 
        “express”: “^4.13.3”, 
        “grunt-aws”: “^0.4.0”, 
        “grunt-aws-s3”: “^0.11.1”, 
        “grunt-banner”: “^0.3.1”, 
        “grunt-bower-concat”: “^0.4.0”, 
        “grunt-ng-annotate”: “^0.8.0”, 
        “grunt-processhtml”: “^0.3.7”, 
        “grunt-shell”: “^1.1.2”, 
        “grunt-stripcomments”: “^0.3.1”, 
        “grunt-uncss”: “^0.4.0”, 
        “load-grunt-tasks”: “^1.0.0” 
    }
}

npmjs.com and Other npm Services

The npm Open Source Terms at https://www.npmjs.com/policies/open-source-terms govern use of https://www.npmjs.com and the npm public registry. The npm Private Packages Terms at https://www.npmjs.com/policies/private-terms govern use of npm Private Packages. The npm Personal Payment Plan https://www.npmjs.com/policies/personal-plan and the npm Organization Payment Plan https://www.npmjs.com/policies/organization-plan govern payment for npm Private Packages.

For any query contact Clofus Innovations.

Contact Us

Just leave your email and our support team will help you